package com.ruoyi.purchase.service.impl;

import java.util.List;

import com.ruoyi.purchase.domain.PlanOrderLink;
import com.ruoyi.purchase.mapper.PlanOrderLinkMapper;
import com.ruoyi.purchase.service.IPlanOrderLinkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * systemService业务层处理
 * 
 * @author kevinness
 * @date 2025-02-10
 */
@Service
public class PlanOrderLinkService implements IPlanOrderLinkService
{
    @Autowired
    private PlanOrderLinkMapper planOrderLinkMapper;

    /**
     * 查询system
     * 
     * @param planNo system主键
     * @return system
     */
    @Override
    public PlanOrderLink selectPlanOrderLinkByPlanNo(String planNo)
    {
        return planOrderLinkMapper.selectPlanOrderLinkByPlanNo(planNo);
    }

    /**
     * 查询system列表
     * 
     * @param planOrderLink system
     * @return system
     */
    @Override
    public List<PlanOrderLink> selectPlanOrderLinkList(PlanOrderLink planOrderLink)
    {
        return planOrderLinkMapper.selectPlanOrderLinkList(planOrderLink);
    }

    /**
     * 新增system
     * 
     * @param planOrderLink system
     * @return 结果
     */
    @Override
    public int insertPlanOrderLink(PlanOrderLink planOrderLink)
    {
        return planOrderLinkMapper.insertPlanOrderLink(planOrderLink);
    }

    /**
     * 修改system
     * 
     * @param planOrderLink system
     * @return 结果
     */
    @Override
    public int updatePlanOrderLink(PlanOrderLink planOrderLink)
    {
        return planOrderLinkMapper.updatePlanOrderLink(planOrderLink);
    }

    /**
     * 批量删除system
     * 
     * @param planNos 需要删除的system主键
     * @return 结果
     */
    @Override
    public int deletePlanOrderLinkByPlanNos(String[] planNos)
    {
        return planOrderLinkMapper.deletePlanOrderLinkByPlanNos(planNos);
    }

    /**
     * 删除system信息
     * 
     * @param planNo system主键
     * @return 结果
     */
    @Override
    public int deletePlanOrderLinkByPlanNo(String planNo)
    {
        return planOrderLinkMapper.deletePlanOrderLinkByPlanNo(planNo);
    }

    /**
     * 批量插入关系信息
     *
     * @param planOrderLinkList 列表
     * @return 结果
     */
    @Override
    public int insertPlanOrderList(List<PlanOrderLink> planOrderLinkList){
        int result = 1;
        for (PlanOrderLink planOrderLink : planOrderLinkList) {
            result = insertPlanOrderLink(planOrderLink);
            if(result < 1 ){
                break;
            }
        }
        return result;
    }
}
